window.onload=function(){
	
	
	
	//轮播图片请求
	let LunboApi='http://15637237221.wicp.vip/yh/HomePage/hotActiveBanner.do'
	axios.post(LunboApi,{
		
	}).then(function(res){
		console.log(res.data.info)
		let arr = res.data.info;
		
		
		let html=''
		for(let i = 0;i<arr.length;i++){
			html+=`
			<li class="swiper-slide">
				<a href=""><div class="rec-banner-wrap"><img src="${arr[i].activeImgUrl}" ></div></a>
				
			</li>
			
			`
		}
		let list=document.querySelector('.swiper-wrapper')
		list.innerHTML=html;
		var swiper = new Swiper('.swiper-container', {
		  slidesPerView: 1,
		  spaceBetween: 30,
		  loop: true,
		  // effect:'coverflow',
		  pagination: {
		    el: '.swiper-pagination',
		    clickable: true,
		  },
		 
		  autoplay:{
			  delay:2000,
			  disableOnInteraction: false, 
		  },
		  navigation: {
		    nextEl: '.swiper-button-next',
		    prevEl: '.swiper-button-prev',
		  },
		});	
		
		
		let ipt = document.querySelector('input')
		ipt.onclick=function(){
			location.href='search.html'
		}
		
	})
	
	
	//艺听就懂请求
	let ytjdApi='http://15637237221.wicp.vip/yh/HomePage/easyUnderstandVideoCourse.do'
	axios.post(ytjdApi,{
		
	}).then(function(res){
		console.log(res.data.info)
		let obj=res.data.info
		let html=''
		let easyList=document.querySelector('.rec-pic-bottom')
		html=`
		<dl>
			<dd><video src="${obj.videoCourseUrl}" poster="${obj.videoCourseImgUrl}" controls="controls"></video></dd>
			<dt>
				<p>${obj.videoCourseId}${obj.videoCourseName}</p>
				<p>导师：${obj.teacherUser.username}</p>
				<p>已有${obj.watchNumber}人听过</p>
				<p>时长 ：${obj.videoTime}</p>
			</dt>
		</dl>
		
		
		`
		easyList.innerHTML=html
	})
	
	//今日推荐请求
		let jrtjApi='http://15637237221.wicp.vip/yh/HomePage/todayRecommendVideoCourse.do';
				let list=document.querySelector('.today-wrap figure')
				console.log(list)
			axios.post(jrtjApi,{
				
			}).then(function(res){
				console.log(res.data.info)
				let obj=res.data.info
			let html=''
			html=`
			<div class="todaytj-wrap">
				<img src="${obj.videoCourseImgUrl}" >
			</div>
			<figcaption>
				<p>${obj.videoCourseName}</p>
				<p>${obj.videoInfo}</p>
				<p><span>导师 ：${obj.videoTitle}</span><span>${obj.watchNumber}人已购</span></p>
			</figcaption>
			
			`
			list.innerHTML=html
			})	
			}